/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package com.plian.system.service.fr.bank.impl;

import com.plian.system.entity.fr.bank.BankOrgStorage;
import com.plian.system.mapper.fr.bank.BankOrgStorageMapper;
import com.plian.system.mybatis.base.BaseServiceImpl;
import com.plian.system.service.fr.bank.IBankOrgStorageService;
import com.plian.system.service.sys.orgzation.IOrgService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 服务实现类
 *
 * @author
 * @since 2019-09-27
 */
@Slf4j
@Service
@AllArgsConstructor
public class BankOrgStorageServiceImpl extends BaseServiceImpl<BankOrgStorageMapper, BankOrgStorage> implements IBankOrgStorageService {

	private final IOrgService orgService;
//
//	/**
//	 * @Author: Take-off
//	 * @Description: //TODO 初始化融资成本率
//	 * @Date: 12:23 PM 2022/8/24
//	 * @Param: []
//	 * @return: void
//	 **/
//	@Override
//	@Transactional(rollbackFor = RuntimeException.class)
//	public void saveFinancingCostRateInit(){
//		List<BankOrgStorage> bankOrgStorages = new ArrayList<>();
//		FacadeQueryVO facadeQueryVO = new FacadeQueryVO();
//		facadeQueryVO.setFinanceType(FinancingVarietiesConstant.type);
//		facadeQueryVO.setBeginData("2021-06-01");
//		List<String> datesByDay = DateUtil.findDatesByDay(1, DateUtil.parse("2021-07-01", DateUtil.PATTERN_DATE), DateUtil.now());
//
//		//所有企业
//		//十三家企业
//		List<Org> allOrg = orgService.list(new LambdaQueryWrapper<Org>().eq(Org::getIsMonitor,1).eq(Org::getParentId,"a71f172f0e9088530098a6ab6ff661f9"));
//		allOrg.add(orgService.getById("a71f172f0e9088530098a6ab6ff661f9"));
//
//		try {
//			for (String day:datesByDay){
//				facadeQueryVO.setEndData(day);
//				KingdeeReturnVO<FacadeSummaryVO> returnVO = KingdeeClient.costCapitalStatistics(facadeQueryVO);
//				if (returnVO.getSuccess()){
//					log.info("金蝶-融资成本率任务成功，月份："+day);
//					List<FacadeSummaryVO> facadeSummaryVOList = getFacadeSummaryVOList(returnVO.getList());
//					for (FacadeSummaryVO facadeSummaryVO:facadeSummaryVOList){
//						String companyCode = facadeSummaryVO.getCompanyCode();
//						List<Org> collect = allOrg.stream().filter(m -> companyCode.equals(m.getOrgCode())).collect(Collectors.toList());
//						if (CollectionUtil.isNotEmpty(collect)){
//							Org org = collect.get(0);
//							BankOrgStorage bankOrgStorage = new BankOrgStorage();
//							bankOrgStorage.setOrgId(org.getId());
//							bankOrgStorage.setOrgCode(org.getOrgCode());
//							bankOrgStorage.setFinancingCostRate(facadeSummaryVO.getDailyFinancingCostRateYear());
//							bankOrgStorage.setDate(DateUtil.parse(day,DateUtil.PATTERN_DATE));
//							bankOrgStorages.add(bankOrgStorage);
//						}
//					}
//				}else {
//					log.info("金蝶-融资成本率任务失败，月份："+day);
//				}
//			}
//		} catch (ServiceException | RemoteException e) {
//			e.printStackTrace();
//		}
//		remove(null);
//		saveList(bankOrgStorages);
//	}
//
//	/**
//	 * @Author: Take-off
//	 * @Description: //TODO 初始化带息负债
//	 * @Date: 12:24 PM 2022/8/24
//	 * @Param: []
//	 * @return: void
//	 **/
//	@Override
//	@Transactional(rollbackFor = RuntimeException.class)
//	public void saveOtherInit(){
//		List<BankOrgStorage> bankOrgStorages = new ArrayList<>();
//		FacadeQueryVO facadeQueryVO = new FacadeQueryVO();
//		facadeQueryVO.setFinanceType(FinancingVarietiesConstant.type);
//
//		List<String> datesByDay = DateUtil.findDatesByDay(1, DateUtil.parse("2021-07-01", DateUtil.PATTERN_DATE), DateUtil.now());
//
//		//十三家企业
//		List<Org> units = orgService.list(new LambdaQueryWrapper<Org>().eq(Org::getIsMonitor,1).eq(Org::getParentId,"a71f172f0e9088530098a6ab6ff661f9"));
//		units.add(orgService.getById("a71f172f0e9088530098a6ab6ff661f9"));
//
//		try {
//			for (String date:datesByDay){
//				for (Org org:units){
//					List<String> company= Collections.singletonList(org.getOrgCode());
//					facadeQueryVO.setQueryDate(date);
//					facadeQueryVO.setCompany(company);
//					KingdeeReturnVO<FacadeSingleVO> returnVO = KingdeeClient.singleBalanceStatistics(facadeQueryVO);
//					if (returnVO.getSuccess()){
//
//						log.info("金蝶-带息负债总额任务成功，月份："+date + "企业：" + org.getName());
//						List<FacadeSingleDataVO> data = returnVO.getList().get(0).getData();
//						//带息负债总额
//						List<BigDecimal> interestBearings = data.stream().filter(m -> "带息负债筹资".equals(m.getFinanceType())).map(FacadeSingleDataVO::getClosingFinancingBalance).collect(Collectors.toList());
//						//间接融资
//						List<BigDecimal> indirectFinancings = data.stream().filter(m -> "间接融资".equals(m.getFinanceType())).map(FacadeSingleDataVO::getClosingFinancingBalance).collect(Collectors.toList());
//						//直接融资
//						List<BigDecimal> directFinancings = data.stream().filter(m -> "直接融资".equals(m.getFinanceType())).map(FacadeSingleDataVO::getClosingFinancingBalance).collect(Collectors.toList());
//
//						BankOrgStorage bankOrgStorage = new BankOrgStorage();
//						bankOrgStorage.setOrgId(org.getId());
//						bankOrgStorage.setOrgCode(org.getOrgCode());
//						if (CollectionUtil.isNotEmpty(interestBearings)){
//							bankOrgStorage.setInterestBearingTotal(interestBearings.get(0));
//						}
//						if (CollectionUtil.isNotEmpty(indirectFinancings)){
//							if (indirectFinancings.size()>1){
//								bankOrgStorage.setIndirectFinancing(indirectFinancings.get(0).add(indirectFinancings.get(1)));
//							}
//						}
//						if (CollectionUtil.isNotEmpty(directFinancings)){
//							if (directFinancings.size()>1){
//								bankOrgStorage.setDirectFinancing(directFinancings.get(0).add(directFinancings.get(1)));
//							}
//						}
//						bankOrgStorage.setDate(DateUtil.parse(date,DateUtil.PATTERN_DATE));
//						bankOrgStorages.add(bankOrgStorage);
//
//					}else {
//						log.info("金蝶-带息负债总额任务失败，月份："+date + "企业：" + org.getName());
//					}
//				}
//			}
//		} catch (ServiceException | RemoteException e) {
//			e.printStackTrace();
//		}
//		for (BankOrgStorage bankOrgStorage:bankOrgStorages){
//			List<BankOrgStorage> list = list(new LambdaQueryWrapper<BankOrgStorage>().eq(BankOrgStorage::getOrgId, bankOrgStorage.getOrgId()).eq(BankOrgStorage::getDate, bankOrgStorage.getDate()));
//			if (CollectionUtil.isNotEmpty(list)){
//				BankOrgStorage one = list.get(0);
//				one.setInterestBearingTotal(bankOrgStorage.getInterestBearingTotal());
//				one.setDirectFinancing(bankOrgStorage.getDirectFinancing());
//				one.setIndirectFinancing(bankOrgStorage.getIndirectFinancing());
//				updateById(one);
//			}else {
//				save(bankOrgStorage);
//			}
//		}
//
//	}
//
//	/**
//	 * @Author: Take-off
//	 * @Description: //TODO 融资成本率每日执行
//	 * @Date: 12:23 PM 2022/8/24
//	 * @Param: []
//	 * @return: void
//	 **/
//	@Override
//	@Transactional(rollbackFor = RuntimeException.class)
//	public void saveFinancingCostRateByDay(String date){
//		List<BankOrgStorage> bankOrgStorages = new ArrayList<>();
//		FacadeQueryVO facadeQueryVO = new FacadeQueryVO();
//		facadeQueryVO.setFinanceType(FinancingVarietiesConstant.type);
//		facadeQueryVO.setBeginData("2021-06-01");
//		//十三家企业
//		List<Org> allOrg = orgService.list(new LambdaQueryWrapper<Org>().eq(Org::getIsMonitor,1).eq(Org::getParentId,"a71f172f0e9088530098a6ab6ff661f9"));
//		allOrg.add(orgService.getById("a71f172f0e9088530098a6ab6ff661f9"));
//
//		try {
//				facadeQueryVO.setEndData(date);
//				KingdeeReturnVO<FacadeSummaryVO> returnVO = KingdeeClient.costCapitalStatistics(facadeQueryVO);
//				if (returnVO.getSuccess()){
//					log.info("金蝶-融资成本率任务成功，月份："+date);
//					List<FacadeSummaryVO> facadeSummaryVOList = getFacadeSummaryVOList(returnVO.getList());
//					for (FacadeSummaryVO facadeSummaryVO:facadeSummaryVOList){
//						String companyCode = facadeSummaryVO.getCompanyCode();
//						List<Org> collect = allOrg.stream().filter(m -> companyCode.equals(m.getOrgCode())).collect(Collectors.toList());
//						if (CollectionUtil.isNotEmpty(collect)){
//							Org org = collect.get(0);
//							BankOrgStorage bankOrgStorage = new BankOrgStorage();
//							bankOrgStorage.setOrgId(org.getId());
//							bankOrgStorage.setOrgCode(org.getOrgCode());
//							bankOrgStorage.setFinancingCostRate(facadeSummaryVO.getDailyFinancingCostRateYear());
//							bankOrgStorage.setDate(DateUtil.parse(date,DateUtil.PATTERN_DATE));
//							bankOrgStorages.add(bankOrgStorage);
//						}
//					}
//				}else {
//					log.info("金蝶-融资成本率任务失败，月份："+date);
//				}
//
//		} catch (ServiceException | RemoteException e) {
//			e.printStackTrace();
//		}
//		remove(new LambdaQueryWrapper<BankOrgStorage>().eq(BankOrgStorage::getDate,date));
//		saveList(bankOrgStorages);
//	}
//
//	/**
//	 * @Author: Take-off
//	 * @Description: //TODO 带息负债.每日执行
//	 * @Date: 12:24 PM 2022/8/24
//	 * @Param: []
//	 * @return: void
//	 **/
//	@Override
//	@Transactional(rollbackFor = RuntimeException.class)
//	public void saveOtherByDay(String date){
//		List<BankOrgStorage> bankOrgStorages = new ArrayList<>();
//		FacadeQueryVO facadeQueryVO = new FacadeQueryVO();
//		facadeQueryVO.setFinanceType(FinancingVarietiesConstant.type);
//		//十三家企业
//		List<Org> units = orgService.list(new LambdaQueryWrapper<Org>().eq(Org::getIsMonitor,1).eq(Org::getParentId,"a71f172f0e9088530098a6ab6ff661f9"));
//		units.add(orgService.getById("a71f172f0e9088530098a6ab6ff661f9"));
//
//		try {
//			for (Org org:units){
//				List<String> company= Arrays.asList(org.getOrgCode());
//				facadeQueryVO.setEndData(date);
//				facadeQueryVO.setCompany(company);
//				KingdeeReturnVO<FacadeSingleVO> returnVO = KingdeeClient.singleBalanceStatistics(facadeQueryVO);
//				if (returnVO.getSuccess()){
//
//					log.info("金蝶-带息负债总额任务成功，月份："+date + "企业：" + org.getName());
//					List<FacadeSingleDataVO> data = returnVO.getList().get(0).getData();
//					//带息负债总额
//					List<BigDecimal> interestBearings = data.stream().filter(m -> "带息负债筹资".equals(m.getFinanceType())).map(FacadeSingleDataVO::getClosingFinancingBalance).collect(Collectors.toList());
//					//间接融资
//					List<BigDecimal> indirectFinancings = data.stream().filter(m -> "间接融资".equals(m.getFinanceType())).map(FacadeSingleDataVO::getClosingFinancingBalance).collect(Collectors.toList());
//					//直接融资
//					List<BigDecimal> directFinancings = data.stream().filter(m -> "直接融资".equals(m.getFinanceType())).map(FacadeSingleDataVO::getClosingFinancingBalance).collect(Collectors.toList());
//
//					BankOrgStorage bankOrgStorage = new BankOrgStorage();
//					bankOrgStorage.setOrgId(org.getId());
//					bankOrgStorage.setOrgCode(org.getOrgCode());
//					if (CollectionUtil.isNotEmpty(interestBearings)){
//						bankOrgStorage.setInterestBearingTotal(interestBearings.get(0));
//					}
//					if (CollectionUtil.isNotEmpty(indirectFinancings)){
//						if (indirectFinancings.size()>1){
//							bankOrgStorage.setIndirectFinancing(indirectFinancings.get(0).add(indirectFinancings.get(1)));
//						}
//					}
//					if (CollectionUtil.isNotEmpty(directFinancings)){
//						if (directFinancings.size()>1){
//							bankOrgStorage.setDirectFinancing(directFinancings.get(0).add(directFinancings.get(1)));
//						}
//					}
//					bankOrgStorage.setDate(DateUtil.parse(date,DateUtil.PATTERN_DATE));
//					bankOrgStorages.add(bankOrgStorage);
//				}else {
//					log.info("金蝶-带息负债总额任务失败，月份："+date + "企业：" + org.getName());
//				}
//			}
//		} catch (ServiceException | RemoteException e) {
//			e.printStackTrace();
//		}
//		for (BankOrgStorage bankOrgStorage:bankOrgStorages){
//			BankOrgStorage one = getOne(new LambdaQueryWrapper<BankOrgStorage>().eq(BankOrgStorage::getOrgId, bankOrgStorage.getOrgId()).eq(BankOrgStorage::getDate, bankOrgStorage.getDate()));
//			if (Optional.ofNullable(one).isPresent()){
//				one.setInterestBearingTotal(bankOrgStorage.getInterestBearingTotal());
//				one.setDirectFinancing(bankOrgStorage.getDirectFinancing());
//				one.setIndirectFinancing(bankOrgStorage.getIndirectFinancing());
//				updateById(one);
//			}else {
//				save(bankOrgStorage);
//			}
//		}
//
//	}
//
//	/**
//	 * @Author: Take-off
//	 * @Description: //TODO 树形平铺
//	 * @Date: 10:31 AM 2022/8/24
//	 * @Param: [list]
//	 * @return: java.util.List<com.plian.system.vo.fr.financing.FacadeSummaryVO>
//	 **/
//	private List<FacadeSummaryVO> getFacadeSummaryVOList(List<FacadeSummaryVO> list){
//		List<FacadeSummaryVO> facadeSummaryVOS = new ArrayList<>();
//		if (CollectionUtil.isNotEmpty(list)){
//			for (FacadeSummaryVO vo:list){
//				getFacadeSummaryVOList(facadeSummaryVOS,vo);
//			}
//		}
//		return facadeSummaryVOS;
//	}
//
//	private void getFacadeSummaryVOList(List<FacadeSummaryVO> facadeSummaryVOS,FacadeSummaryVO vo){
//		facadeSummaryVOS.add(vo);
//		List<FacadeSummaryVO> subCompany = vo.getSubCompany();
//		if (CollectionUtil.isNotEmpty(subCompany)){
//			for (FacadeSummaryVO summaryVO:subCompany){
//				getFacadeSummaryVOList(facadeSummaryVOS,summaryVO);
//			}
//		}
//	}
//
//	/**
//	 * @Author: Take-off
//	 * @Description: //TODO 融资分析折线图
//	 * @Date: 4:38 PM 2022/8/24
//	 * @Param: [dto]
//	 * @return: com.plian.system.vo.report.ChartsVO
//	 **/
//	@Override
//	public ChartsVO getStorageTrend(BankOrgStorageDTO dto){
//		getDefaultDate(dto);
//		//折线图
//		ChartsVO chartsVO = new ChartsVO();
//		//x轴
//		List<XAxisVO> xAxisVOList = new ArrayList<>();
//		XAxisVO xAxisVO = new XAxisVO();
//		List<String> xAxisVOData = new ArrayList<>();
//		xAxisVO.setData(xAxisVOData);
//		xAxisVOList.add(xAxisVO);
//		chartsVO.setXAxis(xAxisVOList);
//		//值
//		List<SeriesVO> seriesVOList = new ArrayList<>();
//		chartsVO.setSeries(seriesVOList);
//		//穿透Id
//		List<String> ids = new ArrayList<>();
//		chartsVO.setIds(ids);
//		Date endDate = dto.getEndDate();
//
//
//		List<String> dates = DateUtil.findDates(1, dto.getStartDate(), DateUtil.minusMillis(DateUtil.plusMonths(endDate,1),1));
//		xAxisVO.setData(dates);
//
//		List<BankOrgStorage> bankOrgStorages = new ArrayList<>();
//		if (orgService.checkIsGzw(dto.getOrgId())){
//			 bankOrgStorages = list(new LambdaQueryWrapper<BankOrgStorage>().ge(BankOrgStorage::getDate, dto.getStartDate()).le(BankOrgStorage::getDate,DateUtil.minusMillis(DateUtil.plusMonths(endDate,1),1))
//					.eq(BankOrgStorage::getOrgId, "a71f172f0e9088530098a6ab6ff661f9"));
//		}else {
//			bankOrgStorages = list(new LambdaQueryWrapper<BankOrgStorage>().ge(BankOrgStorage::getDate, dto.getStartDate()).le(BankOrgStorage::getDate, DateUtil.minusMillis(DateUtil.plusMonths(endDate,1),1))
//					.eq(BankOrgStorage::getOrgId, dto.getOrgId()));
//		}
//		if (CollectionUtil.isNotEmpty(bankOrgStorages)){
//			SeriesVO seriesVO = SeriesVO.builder().name("融资分析折线图").type("line").build();
//			seriesVOList.add(seriesVO);
//			List<Object> data = new ArrayList<>();
//			seriesVO.setData(data);
//			for (String date:dates){
//				Date start = DateUtil.parse(date, DateUtil.PATTERN_MONTH);
//				Date end = DateUtil.minusMillis(DateUtil.plusMonths(start, 1), 1);
//				List<BankOrgStorage> storages = bankOrgStorages.stream().filter(m -> m.getDate().compareTo(start) >= 0 && m.getDate().compareTo(end) <= 0).sorted(Comparator.comparing(BankOrgStorage::getDate).reversed()).collect(Collectors.toList());
//				BigDecimal value = BigDecimal.ZERO;
//				if (CollectionUtil.isNotEmpty(storages)){
//					switch (dto.getType()){
//						case 1:value = storages.get(0).getFinancingCostRate();break;
//						case 2:value = storages.get(0).getInterestBearingTotal();break;
//						case 3:value = storages.get(0).getDirectFinancing();break;
//						case 4:value = storages.get(0).getIndirectFinancing();break;
//						default:break;
//					}
//				}
//				data.add(value);
//			}
//		}
//		return chartsVO;
//	}
//
//	/**
//	 * @Author: Take-off
//	 * @Description: //TODO 融资分析报表
//	 * @Date: 5:08 PM 2022/8/24
//	 * @Param: [dto]
//	 * @return: com.plian.system.vo.report.ReportReturnVO
//	 **/
//	@Override
//	public ReportReturnVO getStorageReport(BankOrgStorageDTO dto){
//		getDefaultDate(dto);
//		ReportReturnVO reportReturnVO = new ReportReturnVO();
//		ReportVO reportVO = new ReportVO();
//		Date endDate = DateUtil.minusMillis(DateUtil.plusMonths(dto.getEndDate(), 1), 1);
//
//		List<Org> orgList = new ArrayList<>();
//		if (orgService.checkIsGzw(dto.getOrgId())){
//			orgList = orgService.list(new LambdaQueryWrapper<Org>().eq(Org::getIsMonitor, 1).eq(Org::getParentId, "a71f172f0e9088530098a6ab6ff661f9"));
//		}else {
//			orgList = orgService.list(new LambdaQueryWrapper<Org>().eq(Org::getParentId, dto.getOrgId()));
//		}
//		List<BankOrgStorage> bankOrgStorageList = list(new LambdaQueryWrapper<BankOrgStorage>().le(BankOrgStorage::getDate, endDate).in(BankOrgStorage::getOrgId, orgList.stream().map(Org::getId).collect(Collectors.toList())));
//		if (CollectionUtil.isNotEmpty(bankOrgStorageList)){
//			Map<Date, List<BankOrgStorage>> storageByDate = bankOrgStorageList.stream().collect(Collectors.groupingBy(BankOrgStorage::getDate));
//			List<Date> dates = storageByDate.keySet().stream().sorted().collect(Collectors.toList());
//			bankOrgStorageList = storageByDate.get(dates.get(dates.size() - 1));
//		}
//		reportVO.setData(getReportVO(bankOrgStorageList, dto.getType(), orgList));
//
//		reportVO
//				.addHeader(HeaderVO.builder().key("serialNumber").title("序号").build())
//				.addHeader(HeaderVO.builder().key("orgName").title("企业名称").build());
//		switch (dto.getType()){
//			case 1:reportVO.addHeader(HeaderVO.builder().key("financingCostRate").title("融资成本率(%)").build());break;
//			case 2:reportVO.addHeader(HeaderVO.builder().key("interestBearingTotal").title("带息负债总额(万元)").build());break;
//			case 3:reportVO.addHeader(HeaderVO.builder().key("directFinancing").title("直接融资(万元)").build());break;
//			case 4:reportVO.addHeader(HeaderVO.builder().key("indirectFinancing").title("间接融资(万元)").build());break;
//			default:break;
//		}
//		reportReturnVO.setGrids(reportVO);
//		return reportReturnVO;
//
//
//	}
//
//	/**
//	 * @Author: Take-off
//	 * @Description: //TODO 添加默认开始时间，结束时间
//	 * @Date: 11:29 AM 2022/9/15
//	 * @Param: [dto]
//	 * @return: void
//	 **/
//	private void getDefaultDate(BankOrgStorageDTO dto){
//		if (!Optional.ofNullable(dto.getEndDate()).isPresent()){
//			Date end = DateUtil.parse(DateUtil.format(DateUtil.now(), DateUtil.PATTERN_MONTH), DateUtil.PATTERN_MONTH);
//			dto.setEndDate(DateUtil.minusDays(end, 1));
//		}
//		if (!Optional.ofNullable(dto.getStartDate()).isPresent()){
//			Date endDate = dto.getEndDate();
//			dto.setStartDate(DateUtil.minusYears(endDate,1));
//		}
//	}
//
//	/**
//	 * @Author: Take-off
//	 * @Description: //TODO 转化为报表VO类
//	 * @Date: 5:02 PM 2022/8/24
//	 * @Param: [bankOrgStorageList, type, orgList]
//	 * @return: java.util.List<com.plian.system.vo.fr.bank.BankOrgStorageVO>
//	 **/
//	private List<BankOrgStorageVO> getReportVO(List<BankOrgStorage> bankOrgStorageList,Integer type,List<Org> orgList){
//		List<BankOrgStorageVO> bankOrgStorageVOS = new ArrayList<>();
//		if (CollectionUtil.isNotEmpty(bankOrgStorageList)){
//			//排序
//			switch (type){
//				case 1:bankOrgStorageList = bankOrgStorageList.stream().filter(m -> Optional.ofNullable(m.getFinancingCostRate()).isPresent()).sorted(Comparator.comparing(BankOrgStorage::getFinancingCostRate).reversed()).collect(Collectors.toList());break;
//				case 2:bankOrgStorageList = bankOrgStorageList.stream().filter(m -> Optional.ofNullable(m.getInterestBearingTotal()).isPresent()).sorted(Comparator.comparing(BankOrgStorage::getInterestBearingTotal).reversed()).collect(Collectors.toList());break;
//				case 3:bankOrgStorageList = bankOrgStorageList.stream().filter(m -> Optional.ofNullable(m.getDirectFinancing()).isPresent()).sorted(Comparator.comparing(BankOrgStorage::getDirectFinancing).reversed()).collect(Collectors.toList());break;
//				case 4:bankOrgStorageList = bankOrgStorageList.stream().filter(m -> Optional.ofNullable(m.getIndirectFinancing()).isPresent()).sorted(Comparator.comparing(BankOrgStorage::getIndirectFinancing).reversed()).collect(Collectors.toList());break;
//				default:break;
//			}
//			int a =1;
//			//企业名称
//			for (BankOrgStorage storage:bankOrgStorageList){
//				BankOrgStorageVO bankOrgStorageVO = new BankOrgStorageVO();
//				List<Org> orgs = orgList.stream().filter(m -> storage.getOrgId().equals(m.getId())).collect(Collectors.toList());
//				if (CollectionUtil.isNotEmpty(orgs)){
//					bankOrgStorageVO.setOrgName(orgs.get(0).getName());
//				}
//				bankOrgStorageVO.setFinancingCostRate(storage.getFinancingCostRate());
//				bankOrgStorageVO.setInterestBearingTotal(storage.getInterestBearingTotal());
//				bankOrgStorageVO.setDirectFinancing(storage.getDirectFinancing());
//				bankOrgStorageVO.setIndirectFinancing(storage.getIndirectFinancing());
//				bankOrgStorageVO.setSerialNumber(a + "");
//				bankOrgStorageVOS.add(bankOrgStorageVO);
//				a++;
//			}
//		}
//		return bankOrgStorageVOS;
//	}

}
